﻿[
    {
        $addFields: {
            "EmpNo": "$people_no",
            "EmpName": "$people_name",
            "DeptName": "$ou_name",
            "PositionName": "$position_name",
            "Email": "$email"
        }
    },
    {
        $match: {
            "email": { $regex: /@pangeo.com$/ },
            $or: [
                { "ou_name": { $regex: /^质量部/ } },
                { "ou_name": { $regex: /^制造工程部/ } },
                { "ou_name": { $regex: /^项目部/ } },
                { "ou_name": { $regex: /^生产部/ } },
                { "ou_name": { $eq: "采购部/SQE" } }
            ],
            "position_name": { $not: { $regex: /部长/ } }
        }
    },
    {
        $sort: { "ou_name": 1, "position_name": 1 }
    },
    {
        $project: {
            "EmpNo": 1,
            "EmpName": 1,
            "DeptName": 1,
            "PositionName": 1,
            "Email": 1,
            "_id": 0
        }
    }
]